<style type="text/css">
    .header{padding:10px 0 10px 15px;}
    .content{padding-left: 10px;}
    .content ul:after{clear: both;float:none;content: '';height:0;}
    .content ul li{float:left;padding-right: 10px;position:relative;line-height:22px;width:100px;}
</style>
<div class="goodslist">
    <div class="header clearfix">
        &nbsp;&nbsp;用户名 :<input type="text" name="keyword" id="keyword" class="input-text" size="20" />
        <input type="button" class="btn btn_submit" name="dosubmit" id="dosubmit" onclick="getData(1);" value="提&nbsp;&nbsp;交">
    </div>
    <div class="content">
        <ul id="lists" class="clearfix" data-uri="{:url('Admin/ajaxGetList')}" data-totalpage="{$totalPage}">

        </ul>
        <div id="pages"></div>
    </div>
</div>
<script type="text/html" id="templates">
    {{# for(var i = 0, len = d.length; i < len; i++){ }}
    <li>
        <input type="{$type}" value="{{d[i]['id']}}" id="u_{{d[i]['id']}}" class="ckbox" name="bid" />
        <label for="u_{{d[i]['id']}}" class="bid_name">{{d[i]['username']}}</label>
    </li>
    {{# } }}
</script>
<script src="__PUBLIC__/js/layer/laytpl.js"></script>
<script src="__PUBLIC__/js/layer/laypage.js"></script>
<script>
    //运行
    getData(1);
    function getData(curr){
        $.getJSON(document.getElementById('lists').getAttribute('data-uri'), {
            page: curr || 1, //向服务端传的参数
            keyword : $("#keyword").val()
        }, function(res){
            if(res.status == 1){
                var gettpl = document.getElementById('templates').innerHTML;
                laytpl(gettpl).render(res.data, function(html){
                    document.getElementById('lists').innerHTML = html;
                });
            }else{
                document.getElementById('lists').innerHTML = '<li>'+res.msg+'</li>';
            }
            //显示分页
            laypage({
                cont: 'pages', //容器。值支持id名、原生dom对象，jquery对象。【如该容器为】：<div id="page1"></div>
                pages: document.getElementById('lists').getAttribute('data-totalpage'), //通过后台拿到的总页数
                curr: curr || 1, //当前页
                jump: function(obj, first){ //触发分页后的回调
                    if(!first){ //点击跳页触发函数自身，并传递当前页：obj.curr
                        getData(obj.curr);
                    }
                }
            });
        });
    }

</script>